package com.da.mybatis.convertor;

import java.util.List;

import com.da.mybatis.bean.Student;
import com.da.mybatis.bean.StudentDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author JokerDa.
 * @date 2020/12/27 10:39
 * Description:https://blog.csdn.net/weixin_47098539/article/details/109073930
 * 只要单个的配置了@Mappings映射，list也可以使用映射无需配置
 */
@Mapper(componentModel = "spring")
public interface StudentConvertor {

    List<StudentDTO> convertList(List<Student> student);

    @Mappings({
        @Mapping(source = "name", target = "studentName")
    })
    StudentDTO convert(Student student);
}
